[Proposition] Add nix flake for flow-cli installation and development#2277
[Proposition] Add nix flake for flow-cli installation and development#2277janezpodhostnik merged 2 commits intomasterfrom
Conversation
|
I’m not very familiar with Nix. What are the benefits compared to the additional maintenance this would introduce? |
|
This adds a very convenient way to try/install flow-cli on nixos (or nix-darwin for that matter). for instance you can just do There won't be any additional overhead for any other installation or any parts of the code. The flake.nix (and the lock) might need some adjusting from time to time for continued support of nix installation. I can do that for now, as I will be using it, and if someone complains down the line, they can update it or you can remove it. |
There was a problem hiding this comment.
Pull request overview
This pull request adds Nix flake support for installing and developing the Flow CLI on NixOS and systems with the Nix package manager. This provides an alternative installation and development method that complements the existing installation scripts and build tools (Makefile, goreleaser).
Changes:
- Added flake.nix with package definition, development shell, and version detection from git tags
- Added flake.lock to pin Nix dependencies
- Updated CONTRIBUTING.md with Nix-specific development instructions
- Updated .gitignore to exclude Nix build artifacts
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| flake.nix | Defines Nix package build for flow-cli using buildGoModule, development shell with Go tooling, and apps configuration |
| flake.lock | Locks Nix flake dependencies (nixpkgs and flake-utils) |
| CONTRIBUTING.md | Adds "Getting Started with Nix" section with instructions for nix develop and nix build |
| .gitignore | Adds Nix-specific artifacts (result, result-*, .direnv/) to gitignore |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
I have been using this flake locally to install flow-cli on NixOs and on NixDarvin. I think it might be nice to add it for anyone else trying to use the flow-cli in a nix environment.
I will also update the install documentation to include Nix.
Eventually I would like to add this to https://github.com/NixOS/nixpkgs. so its even easier to use.
The nix instructions (that I will put in the docs) would be:
Installing Flow CLI with Nix
The Flow CLI can be installed on NixOS and systems with Nix package manager using Nix flakes.
Prerequisites
Ensure you have Nix installed with flakes enabled. Add to
/etc/nix/nix.confor~/.config/nix/nix.conf:Installation Methods
1. Try Without Installing
Run the latest version directly:
2. Install to User Profile
Install persistently:
3. Use in NixOS Configuration
Add to your
configuration.nix:4. Use in Home Manager
Add to your flake inputs and home configuration:
5. Development Shell
Enter a development environment with Flow CLI and Go tooling:
Or for local development:
cd flow-cli nix developInstalling Specific Versions
Install a specific version using git tags:
The flake automatically extracts the version from the git tag when building from a tagged ref.
Upgrading
Update to the latest version:
Uninstalling
Remove from profile:
For contributor use:
masterbranchFiles changedin the Github PR explorer